package com.qiangou.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.entity.Tags;
import com.entity.Type_Tags;
import com.qiangou.dao.CreditDao;
import com.qiangou.service.CreditService;

@Service("creditService")
public class CreditServiceImpl implements CreditService{
	@Resource(name="creditDao")
	private CreditDao creditDao;
	
	@Override
	public Integer getCrerditCount(List<String> tags) {
		return creditDao.getCrerditCount(tags);
	}

	@Override
	public List<String> getTagNames(String[] types) {
		return creditDao.getTagNames(types);
	}

	@Override
	public List<Type_Tags> getType_Tags() {
		List<Type_Tags> type_tags=new ArrayList<Type_Tags>();
		type_tags=creditDao.getTypes();
		for (Type_Tags tt : type_tags) {
			tt.setTags(creditDao.getTagsByType(tt.getId()));
		}
		return type_tags;
	}

	@Override
	public List<Tags> getTagsBySearch(String param) {
		return creditDao.getTagsBySearch(param);
	}
}
